clear
set type double
set more 1

***************************************
*NOTES
*alterntive instruments for online appendix
*********************************************************************


use ../data/xcurrencychoice_estdata, clear


*******************************
*TABLE 3 - col 5
**************************************
est clear
 
*both type of instruments
eststo col1: ivreghdfe Ix mphi_xeu lnmemp ms  (mshcompetitor_other = IVsh_US IVsh_CHN IVsh_other lncomp_memp comp_mphi_xeu ), absorb(cty_num hs4 date) cluster(vat) first savefirst savefprefix(col1_fs_)


*macro
eststo col2: ivreghdfe Ix mphi_xeu lnmemp ms  (mshcompetitor_other = IVsh_US IVsh_CHN IVsh_other ), absorb(cty_num hs4 date) cluster(vat) first savefirst savefprefix(col2_fs_)


*micro
eststo col3: ivreghdfe Ix mphi_xeu lnmemp ms  (mshcompetitor_other = lncomp_memp comp_mphi_xeu ), absorb(cty_num hs4 date) cluster(vat) first savefirst savefprefix(col3_fs_)


*only US in the macro
**************************
*macro
eststo col4: ivreghdfe Ix mphi_xeu lnmemp ms  (mshcompetitor_other = IVsh_US  ), absorb(cty_num hs4 date) cluster(vat) first savefirst savefprefix(col4_fs_)

*both types of instruments
***********************************
eststo col5: ivreghdfe Ix mphi_xeu lnmemp ms  (mshcompetitor_other = IVsh_US lncomp_memp comp_mphi_xeu ), absorb(cty_num hs4 date) cluster(vat) first savefirst savefprefix(col5_fs_)

* Export IV regs table 
esttab col? using "../results/AppendixTableB4_xchoiceIV.csv", se  b(3) se(3) r2 ar2 star(* 0.10 ** 0.05 *** 0.01) order(mphi_xeu ms lnmemp mshcompetitor_other) scalars("cdf Cragg-Donald F stat" "rkf Kleibergen-Paap F stat" "j Hansen J stat" "jp Hansen J stat p-val") compress replace

* Export fist-stage regs table
esttab col?_fs_* using "../results/AppendixTableB4_xchoiceIV_fs.csv", nodepvars se b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) compress replace
eststo clear

exit


